{template 'header', $template}
<div id="head-bar">
<div class="head-bar">
<div class="head-bar-back">
<a href="{$back_link}"><img src="{DT_MOB}static/img/icon-back.png" width="24" height="24"/><span>返回</span></a>
</div>
<div class="head-bar-title">{$head_name}</div>
<div class="head-bar-right">
{if $TYPE}
<a href="javascript:window.scrollTo(0,0);$('#type-{$file}-{$moduleid}').slideToggle(300);"><img src="{DT_MOB}static/img/icon-action.png" width="24" height="24"/></a>
{/if}
</div>
</div>
<div class="head-bar-fix"></div>
</div>
{if $TYPE}
<div id="type-{$file}-{$moduleid}" style="display:none;">
<div class="list-set">
<ul>
{loop $_TP[0] $v0}
<li{if $typeid==$v0[typeid]} style="background:#F6F6F6;"{/if}><div><a href="{userurl($username, 'file='.$file.'&typeid='.$v0['typeid'], $domain)}">{$v0[typename]}</a></div></li>
{if isset($_TP[1][$v0[typeid]])}
{loop $_TP[1][$v0[typeid]] $v1}
<li{if $typeid==$v1[typeid]} style="background:#F6F6F6;"{/if}><div><a href="{userurl($username, 'file='.$file.'&typeid='.$v1['typeid'], $domain)}">&nbsp;&nbsp;&nbsp;&nbsp;{$v1[typename]}</a></div></li>
{/loop}
{/if}
{/loop}
</ul>
</div>
<div class="blank-35 bd-b"></div>
</div>
{/if}
{if $itemid}
<style type="text/css">
.relate_1,.relate_2 {width:65px;height:60px;float:left;}
.relate_1 img,.relate_2 img{width:50px;height:50px;}
.relate_1 a:link,.relate_1 a:visited,.relate_1 a:active,.relate_1 a:hover {display:block;width:50px;height:50px;border:#B2B2B2 1px solid;border-radius:4px;}
.relate_2 a:link,.relate_2 a:visited,.relate_2 a:active,.relate_2 a:hover {display:block;width:50px;height:50px;border:#007AFF 1px solid;border-radius:4px;}
.step_price {background:#F8F8F8;text-align:center;}
.step_price td {border-right:#FFFFFF 1px solid;}
.nv_1,.nv_2 {float:left;padding:5px;margin:0 5px 5px 0;cursor:pointer;}
.nv_1 {border:#B2B2B2 1px solid;border-radius:4px;}
.nv_2 {border:#007AFF 1px solid;border-radius:4px;}
.tl {width:50px;text-align:center;}
</style>
<div class="main">
	<div class="title"><strong>{$title}</strong></div>
	<div class="info">{if $MOD[hits]}人气:{$hits}&nbsp;&nbsp;{/if}销量:{$sales}&nbsp;&nbsp;评价:{$comments}</div>
	{if $thumb}{template 'album', 'chip'}{/if}
	
	{if $a2}
	<div class="step_price">
	<table width="100%" cellpadding="6" cellspacing="0">
	<tr>
	<td>起批</td>
	<td>{$a1}-{$a2}{$unit}</td>
	{if $a3}
	<td>{$a2+1}-{$a3}{$unit}</td>
	<td>{$a3}{$unit}以上</td>
	{else}
	<td>{$a2+1}{$unit}以上</td>
	{/if}
	</tr>
	<tr>
	<td>价格</td>
	<td class="f_red">{$DT[money_sign]}{$p1}</td>
	{if $a3}
	<td class="f_red">{$DT[money_sign]}{$p2}</td>
	<td class="f_red">{$DT[money_sign]}{$p3}</td>
	{else}
	<td class="f_red">{$DT[money_sign]}{$p2}</td>
	{/if}
	</tr>
	</table>
	</div>
	{/if}


<table width="100%" cellpadding="6" cellspacing="0">
{if !$a2}
<tr>
<td class="tl">单价</td>
<td class="f_red">{$DT[money_sign]}<span class="px16">{$price}</span></td>
</tr>
{/if}
{if $express_name_1 == '包邮'}
<tr>
<td class="tl">物流</td>
<td>
{if $fee_start_1>0}
{if $fee_start_2>0} {$express_name_2}:{$fee_start_2}&nbsp;&nbsp;{/if}
{if $fee_start_3>0} {$express_name_3}:{$fee_start_3}&nbsp;&nbsp;{/if}
满{$fee_start_1}包邮
{else}
包邮
{/if}</td>
</tr>
{elseif $fee_start_1>0 || $fee_start_2>0 || $fee_start_3>0}
<tr>
<td class="tl">物流</td>
<td>
{if $fee_start_1>0} {$express_name_1}:{$fee_start_1}&nbsp;&nbsp;{/if}
{if $fee_start_2>0} {$express_name_2}:{$fee_start_2}&nbsp;&nbsp;{/if}
{if $fee_start_3>0} {$express_name_3}:{$fee_start_3}&nbsp;&nbsp;{/if}
</td>
</tr>
{/if}
{if $cod}
<tr>
<td class="tl">到付</td>
<td>支持货到付款</td>
</tr>
{/if}
<tr>
<td class="tl">库存</td>
<td>{$amount}{$unit}</td>
</tr>
<tr>
<td class="tl">品牌</td>
<td>{if $brand}{$brand}{else}未填写{/if}</td>
</tr>
{if $RL}
<tr>
<td class="tl">{$relate_name}</td>
<td>
{loop $RL $v}
<div class="relate_{if $itemid==$v[itemid]}2{else}1{/if}">{if $itemid==$v[itemid]}<em></em>{/if}<a href="{$MOD[mobile]}{$v[linkurl]}"><img src="{$v[thumb]}" alt="" title="{$v[relate_title]}"/></a></div>
{/loop}				
</td>
</tr>
{/if}
{if $P1}
<tr>
<td class="tl">{$n1}</td>
<td id="p1">
<ul>
{loop $P1 $i $v}
<li class="nv_{if $i==0}2{else}1{/if}">{$v}</li>
{/loop}
</ul>
</td>
</tr>
{/if}
{if $P2}
<tr>
<td class="tl">{$n2}</td>
<td id="p2">
<ul>
{loop $P2 $i $v}
<li class="nv_{if $i==0}2{else}1{/if}">{$v}</li>
{/loop}
</ul>
</td>
</tr>
{/if}
{if $P3}
<tr>
<td class="tl">{$n3}</td>
<td id="p3">
<ul>
{loop $P3 $i $v}
<li class="nv_{if $i==0}2{else}1{/if}">{$v}</li>
{/loop}
</ul>
</td>
</tr>
{/if}
{if $amount}
{if $status == 3}
{else}
<tr>
<td></td>
<td><strong class="f_red px14">该商品已下架</strong></td>
</tr>				
{/if}
{else}
<tr>
<td></td>
<td><strong class="f_red px14">该商品库存不足</strong></td>
</tr>
{/if}

</table>
	<div class="list-tab bd-t">
		<ul>
			<li class="on" id="t_0" onclick="Mshow(0)"><span>商品详情</span></li>
			<li id="t_1" onclick="Mshow(1)"><span>评价详情({$comments})</span></li>
			<li id="t_2" onclick="Mshow(2)"><span>交易记录({$orders})</span></li>
		</ul>
	</div>
	<div id="c_2" style="display:none;"><div class="list-empty">正在加载交易记录...</div></div>
	<div id="c_1" style="display:none;"><div class="list-empty">正在加载评价详情...</div></div>
	<div class="content" id="c_0">{$content}</div>
	<div class="head bd-b"><strong>联系方式</strong></div>
	<div class="contact">{template 'contact', 'chip'}</div>
</div>
{if $status == 3 && $amount > 0}
<div class="foot-bar-fix"></div>
<div class="foot-bar">
	<table cellpadding="8" cellspacing="0" width="100%">
	<tr>
	<td width="50%" onclick="AddCart();"><div class="btn-green" style="line-height:32px;font-size:16px;">加入购物车</div></td>
	<td width="50%" onclick="BuyNow();"><div class="btn-orange" style="line-height:32px;font-size:16px;">立即购买</div></td>
	</tr>
	</table>
</div>
{/if}
<script type="text/javascript">
var mallurl = '{$MOD[mobile]}';
var mallmid = {$moduleid};
var mallid = {$itemid};
var n_c = {$comments};
var n_o = {$orders};
var c_c = Dd('c_1').innerHTML;
var c_o = Dd('c_2').innerHTML;
var s_s = {'1':0,'2':0,'3':0};
var m_l = {
	no_comment:'暂无评论',
	no_order:'暂无交易',
	no_goods:'商品不存在或已下架',
	no_self:'不能添加自己的商品',
	lastone:''
};
function Mshow(k) {
	if($('#t_'+k).attr('class') == 'on') return;
	for(var i = 0; i < 3; i++) {
		if(i == k) {
			$('#t_'+i).attr('class', 'on');
			$('#c_'+i).show();
			if(k == 1) load_comment(0);
			if(k == 2) load_order(0);
		} else {
			$('#t_'+i).attr('class', '');
			$('#c_'+i).hide();
		}
	}
}
function addE(i) {
	$('#p'+i+' li').click(function() {
		$('#p'+i+' li')[s_s[i]].className = 'nv_1';
		this.className = 'nv_2';
		s_s[i] = $(this).index();
	});
}
function BuyNow() {
	Go('{$MODULE[2][mobile]}buy.php?mid={$moduleid}&itemid={$itemid}&s1='+s_s[1]+'&s2='+s_s[2]+'&s3='+s_s[3]+'&a=1');
}
function AddCart() {
	Go('{$MODULE[2][mobile]}cart.php?mid={$moduleid}&itemid={$itemid}&s1='+s_s[1]+'&s2='+s_s[2]+'&s3='+s_s[3]+'&a=1');
}
function load_comment(p) {
	if(n_c == 0) {
		Dd('c_1').innerHTML = '<div class="comment_no">'+m_l.no_comment+'</div>';
		return;
	}
	if(p == 0 && Dd('c_1').innerHTML != c_c) return;
	$('#c_1').load(AJPath+'?action=mall&job=comment&moduleid='+mallmid+'&sum='+n_c+'&itemid='+mallid+'&page='+p);
}
function load_order(p) {
	if(n_o == 0) {
		Dd('c_2').innerHTML = '<div class="order_no">'+m_l.no_order+'</div>';
		return;
	}
	if(p == 0 && Dd('c_2').innerHTML != c_o) return;
	$('#c_2').load(AJPath+'?action=mall&job=order&moduleid='+mallmid+'&sum='+n_o+'&itemid='+mallid+'&page='+p);

}
$(function(){
	{if $P1}addE(1);{/if}
	{if $P2}addE(2);{/if}
	{if $P3}addE(3);{/if}
});
</script>
{else}
{if $lists}
{loop $lists $v}
<div class="list-img">
<a href="{$v[linkurl]}"><img src="{if $v[thumb]}{$v[thumb]}{else}{DT_MOB}static/img/60x60.png{/if}" width="60" height="60" alt="" onerror="this.src='{DT_MOB}static/img/60x60.png';"/></a>
<ul>
<li><a href="{$v[linkurl]}"><strong>{$v[title]}</strong></a></li>
<li><i>{$DT[money_sign]}{$v[price]}</i><span>{timetodate($v[edittime], 5)}</span></li>
</ul>
</div>
{/loop}
{else}
{template 'empty', 'chip'}
{/if}
{if $pages}<div class="pages">{$pages}</div>{/if}
{/if}
{template 'footer', $template}